package com.example.customer.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * @Description
 * @Date 2022-01-05 10:52
 * @Author wdg
 */
@RestController
@RequestMapping("/http")
public class HttpController {

    /**
     * 注入
     */
    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/getRemoteList")
    public List<String> getRemoteList() {
        String url = "http://provider-demo/api/getListApi";
        List remoteList = restTemplate.getForEntity(url, List.class).getBody();
        return remoteList;
    }

}
